﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HairSingleModifier : MonoBehaviour
{
    public List<int> mid;
    public List<int> side;
    public List<int> outline;
    Mesh mesh;
    // Use this for initialization
    void Start()
    {
        mesh = GetComponent<MeshFilter>().mesh;
        mesh.GetTriangles(mid, 0);
        mesh.GetTriangles(outline, 1);
        side = ListTool.BooleanIntersec(mid, outline);
        ListTool.BooleanSubject(mid, side);
        ListTool.BooleanSubject(outline, side);
        ListTool.RemoveDuplicate(outline, side, mid);
    }
    public float thickness;
    void OnGUI()
    {
        if (GUILayout.Button("set"))
        {
            var verts = mesh.vertices;
            foreach (var i in mid)
            {
                verts[i] = verts[i].SetX(thickness);
            }
            mesh.vertices = verts;
        }
    }
}
